<?php
/**
 * Author: 式神(vashi)
 * email: 289650682@qq.com
 * Date: 2019/1/7 17:14
 * FileName: Admin.php
 */

namespace app\common\validate;


use think\Validate;

class Admin extends  Validate
{
    protected  $rule=[
        'username|用户名'=>['require'],
        'password|密码'=>['require','min:6','max:20'],
        'edit_pass|密码'=>['min:6','max:20'],
        'new_pass|新密码'=>['require','min:6','max:20'],
        'ture_pass|确认密码'=>['require','confirm:new_pass'],
        'nickname|昵称'=>['require'],
        'email|电子邮件'=>['email'],
    ];

    protected $message=[
        'username.require' => ':attribute 不能为空！',
        'password.require' => ':attribute 不能为空！',
        'new_pass.require' => ':attribute 不能为空！',
        'ture_pass.require' => ':attribute 不能为空！',
        'ture_pass.confirm' => ':attribute 和 新密码不一致！',
        'nickname.require' => ':attribute 不能为空！',
        'email.email' => ':attribute 电子邮件格式不正确！',
    ];

    protected $scene=[
        'login'=>['username','password.require'],   //登陆验证
        'create'=>['username','password','email'],   //创建验证
        'pass'=>['password','new_pass','ture_pass'], //修改密码验证
        'edit'=>['username','email'],
    ];
}